package org.sang.controller;/*
 * @author  gaokecheng
 * @date 2019/9/16 14:07
 *
 *
 * */

import org.sang.bean.Employee;
import org.sang.bean.MsgContent;
import org.sang.bean.RespBean;
import org.sang.service.ElasticService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/elastic")
public class ElasticEmpController {
    @Autowired
    ElasticService elasticService;

    @RequestMapping(value = "/msgContent",method = RequestMethod.GET)
    public Map<String,Object> getMsgContent(){
        System.out.println("zhenghuo+chenggo哈空间和空间噶");
        List<MsgContent> list= elasticService.getMsgContent();
        Map<String ,Object> map = new HashMap<>();
        map.put("data",list);
        map.put("status",200);
        return map;
    }
    @RequestMapping(value = "/msgContentByKey",method = RequestMethod.GET)
    public Map<String,Object> msgContentByKey(String searchContent){
        List<MsgContent> list= elasticService.getMsgContentByKey(searchContent);
        Map<String ,Object> map = new HashMap<>();
        map.put("data",list);
        map.put("status",200);
        return map;
    }
}
